<?php namespace App\Models;

use Illuminate\Database\Eloquent\Model;

/**
 * 投票奖项
 * Class VoteAward
 *
 * @package App\Models
 * @property int $id
 * @property string $name 名称
 * @property string $created_at
 * @property string $updated_at
 * @method static \Illuminate\Database\Query\Builder|\App\Models\VoteAward whereId($value)
 * @method static \Illuminate\Database\Query\Builder|\App\Models\VoteAward whereCreatedAt($value)
 * @method static \Illuminate\Database\Query\Builder|\App\Models\VoteAward whereUpdatedAt($value)
 * @method static \Illuminate\Database\Query\Builder|\App\Models\VoteAward whereName($value)
 * @mixin \Eloquent
 */
class VoteAward extends Model
{

    protected $fillable = ['name'];

    /**
     * 用于select的列表
     * @return array
     */
    public static function getListData()
    {
        $infos = self::all();
        $listData = ['0' => '请选择'];
        foreach ($infos as $info) {
            $listData[$info->id] = $info->name;
        }
        return $listData;
    }
}